use std::collections::linked_list;
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
fn main() {
    // 手动逐行读取(^_^)
    let f = File::open("readme.md").unwrap();
    let mut reader = BufReader::new(f);
    let mut line = String::new();
    loop {
        let len = reader.read_line(&mut line).unwrap();
        if len == 0 {
            break;
        }
        println!("{} ({} bytes long)", line, len);
        line.truncate(0); //收缩长度到0，防止有之前行得内容遗留下来。
    }

    for line_ in reader.lines() {
        let line = line_.unwrap();
        println!("{} ({} bytes long)", line, line.len());
    }
}
